<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../baselist.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<title></title>
</head>
<script type="text/javascript">
	//只有初始录入状态才能删除
	function isdelete(){
		var state = $("#state").text();
		state = $.trim(state);
		//alert(state.length);
		if(state=="初始录入"){
			formSubmit('deleteById.action','_self');
		}else{
			alert("流程已经启动，不允许删除！");
		}
	}
	//只用初始录入才能启动流程
	function isStart(){
		var checkedObj = $("input[type=checkbox][checked=checked]");
		var checkedLength = checkedObj.length;
		if(checkedLength>1){
			alert("只能选中一个");
			return;
		}else{
			var state = checkedObj.parent().parent().children("td").last().text();
			state = $.trim(state);
			if(state=="初始录入"){
				formSubmit('start.action','_self');
			}else{
				alert("流程已经启动,不能重复启动");
			}
		}
	}
</script>
<body>
<form name="icform" method="post">

<div id="menubar">
<div id="middleMenubar">
<div id="innerMenubar">
  <div id="navMenubar">
<ul>
<li id="new"><a href="#" onclick="formSubmit('tocreate.action','_self');this.blur();">新增</a></li>
<li id="update"><a href="#" onclick="formSubmit('toupdate.action','_self');this.blur();">修改</a></li>
<li id="delete"><a href="#" onclick="isdelete();this.blur();">删除</a></li>
<li id="delete"><a href="#" onclick="isStart();this.blur();">发起申请</a></li>
<li id="new"><a href="#" onclick="formSubmit('${ctx}/qingjia/workflow/viewHisComment.action','_self');this.blur();">审批记录</a></li>
</ul>
  </div>
</div>
</div>
</div>
   
<div class="textbox" id="centerTextbox">
  <div class="textbox-header">
  <div class="textbox-inner-header">
  <div class="textbox-title">
    请假信息列表
  </div> 
  </div>
  </div>
  
<div>

<div class="eXtremeTable" >
<table id="ec_table" class="tableRegion" width="98%" >
	<thead>
	<tr>
		<td class="tableHeader"><input type="checkbox" name="selid" onclick="checkAll('id',this)"></td>
		<td class="tableHeader">序号</td>
		<td class="tableHeader">申请人</td>
		<td class="tableHeader">请假内容</td>
		<td class="tableHeader">开始时间</td>
		<td class="tableHeader">天数</td>
		<td class="tableHeader">备注</td>
		<td class="tableHeader">状态</td>
	</tr>
	</thead>
	<tbody class="tableBody" >
	
	<c:forEach items="${dataList}" var="o" varStatus="status">
	<tr class="odd" onmouseover="this.className='highlight'" onmouseout="this.className='odd'" >
		<td><input type="checkbox" name="id" value="${o.id}"/></td>
		<td>${status.index+1}</td>
		<td>
			<c:forEach items="${sysUserList}" var="user">
				<c:if test="${user.id == o.userId }">
					${user.userName }
				</c:if>
			</c:forEach>
		</td>
		<td>${o.content}</td>
		<td><fmt:formatDate value="${o.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		<td>${o.days}天</td>
		<td>${o.remark}</td>
		<td id="state">
			<c:if test="${o.state==2 }">审批完成</c:if>
			<c:if test="${o.state==1 }">正在审批</c:if>
			<c:if test="${o.state==0 }">初始录入</c:if>
		</td>
	</tr>
	</c:forEach>
	
	</tbody>
</table>
</div>
</div>
 
 
</form>
</body>
</html>

